<?php

namespace Action\Flow\GenericFlow\Item;

class Unlike extends \Library\Action\UserAction 
	implements \Library\Action\AjaxAction {

	private $_item;
	
	public function execute() {
		parent::execute();
		
		$item_id = $this->getParam( 'id' );
		$this->_item = \Bean\Flow\GenericFlow\Item::get( $item_id );
		
		_a( $this->_item->isLikable(), 'You can\'t like this post' );
		
		$this->_item->unlike();
	}
	
	public function getItem() {
		return $this->_item;
	}

}
